using Common.Interfaces;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Unity;

namespace Common.Services
{
    public class ModuleServices:IModuleServices
    {
        private readonly IUnityContainer m_Container;

        public ModuleServices(IUnityContainer m_Container)
        {
            this.m_Container = m_Container;
        }

        public void ActivateView(string viewName)
        {
            var regionManager = m_Container.Resolve<IRegionManager>();

            var workspaceRegion = regionManager.Regions["WorkspaceRegion"];
            foreach(var view in workspaceRegion.Views)
            {
                workspaceRegion.Deactivate(view);
            }
        }
    }
}